package net.techwatch.guice.service;

import net.techwatch.guice.dao.PersonDao;
import net.techwatch.guice.domain.Person;

public class PersonServiceImpl implements PersonService {

	private PersonDao dao;
	
	public PersonServiceImpl() {
		// nothing to do
	}

	public PersonDao getDao() {
		return dao;
	}

	public void setDao(PersonDao dao) {
		this.dao = dao;
	}

	public int numberOfPerson() {
		return dao.getAll().size();
	}

	public void updatePerson(Person person) {
		Person p = dao.findById(person.getId());
		p.setLastName(person.getLastName());
		p.setFirstName(person.getFirstName());
		p.setBirthDate(person.getBirthDate());
	}
}
